{extend name="public:layout" /}
{block name="title"}集采商品{/block}
{block name="head"}
<style>
    i{cursor:pointer}
</style>
{/block}
{block name="body"}
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> 集采商品列表</li>
            </ol>
        </div>
        <div class="ibox-content">
            <div class="toolbar">
                <div class="pull-right">
                    <form class="form-inline" method="post">
                        <div class="form-group">
                            <div class="input-group">
                                <input class="form-control" name="goods_name" type="text" value="{$query.goods_name}" placeholder="请输入商品名称">
                            </div>
                        </div>
                        <button type="submit" class="btn btn-info">
                            <i class="fa fa-search"></i> 搜索
                        </button>
                        <a class="btn btn-white" href="{:url('index')}">
                            <i class="fa fa-trash"></i> 清空
                        </a>
                    </form>
                </div>
                <div class="clearfix"></div>
            </div>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>集采商品</th>
                    <th>开始时间</th>
                    <th>结束时间</th>
                    <th>保证金</th>
                    <th>活动状态</th>
                    <th width="120">操作</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="vo"}
                <tr>
                    <td>
                        <img src="{$vo.goods_thumb|default='/public/nopic.gif'}" class="pull-left" style="width:32px;height:32px;margin:4px;" />
                        {$vo.goods_name}
                    </td>
                    <td>{$vo.begin_time|date='Y-m-d H:i:s',###}</td>
                    <td>{$vo.end_time|date='Y-m-d H:i:s',###}</td>
                    <td>{$vo.margin}</td>
                    <td>{$vo.promotion_status_text}</td>
                    <td class="col-sm-3">
                        {eq name="vo.promotion_status" value="-1" }
                            <a href="{:url('toOrder',['goods_id'=>$vo['goods_id']])}">转化为订单</a>
                        {/eq}
                        <a href="{:url('itemList',['goods_id'=>$vo['goods_id']])}">集采列表</a>
                        <a href="{:url('ShopGoods/edit',['goods_id'=>$vo['goods_id']])}">修改</a>
                        <a href="javascript:;" onclick="doAction(this);"
                           data-msg="删除活动将恢复商品正常销售<br/>确认操作吗？" data-url="{:url('del')}" data-params="goods_id={$vo.goods_id}">删除</a>
                    </td>
                </tr>
                {/volist}
                </tbody>
            </table>
            <div class="page-bar">{$list->render()}</div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    //更新排序
    function updateOrder() {
        if ($(".list_order").length > 0) {
            var data = $(".list_order").serialize();
            var url = "{:url('updateOrder')}";
            getAjax(url, data, function (data) {
                layer.msg(data.msg, {icon: 1, time: 800}, function () {
                    rePage();
                });
            });
        }
    }
    //切换状态
    function setStatus(goodsId,field,status){
        var url="{:url('setStatus')}";
        var params = {goods_id:goodsId,field:field,status:status};
        getAjax(url, params, function (res) {
            rePage();
        });
    }
</script>
{/block}